﻿@using Masa.Blazor.Presets.PageStack
@inherits LayoutComponentBase

<MApp>
    <MMain>
        <PPageStack TabRules="@_tabRules"
                    FallbackUri="/blazor/examples/page-stack/tab1">
            <MContainer>
                @Body
            </MContainer>
        </PPageStack>
    </MMain>

    <MBottomNavigation App Routable Color="primary">
        <PPageStackTab Href="/blazor/examples/page-stack/tab1">
            <MButton @attributes="@context.Attrs">Tab 1</MButton>
        </PPageStackTab>
        <PPageStackTab Href="/blazor/examples/page-stack/tab2/Today">
            <MButton MatchPattern="@("^/blazor/examples/page-stack/tab2/*")"
                     @attributes="@context.Attrs">Tab 2
            </MButton>
        </PPageStackTab>
        <PPageStackTab Href="/blazor/examples/page-stack/tab3">
            <MButton @attributes="@context.Attrs">Tab 3</MButton>
        </PPageStackTab>
    </MBottomNavigation>
</MApp>

@code {

    private readonly HashSet<TabRule> _tabRules =
    [
        new("^/blazor/examples/page-stack/tab1$", Persistent: false),
        new("^/blazor/examples/page-stack/tab2/*", Self: true),
        new("^/blazor/examples/page-stack/tab3$")
    ];

}